package com.chinasoft.mall.model;

import java.io.Serializable;
import java.util.HashMap;

import com.chinasoft.mall.framework.Config;
import com.chinasoft.mall.framework.abs.RequestCallback;
import com.chinasoft.mall.model.response.BaseResponse;

public class BaseBean implements Serializable{
	private static final long serialVersionUID = -2643982918725852771L;

	private RequestCallback rc;

	private int processorId;
	
	private byte url_type=0;

	// 请求类型 1 get 2 post 3 xml 4 上传
	private byte req_type = 1;
	// 是否需要更新缓存
	private boolean isAdd;
	// 请求地址
	private String req_url;
	// 请求状态
	private int status;
	// 请求对象
	public HashMap<String, String> reqData = new HashMap<String, String>(5);
	// 返回对象
	private BaseResponse resData ;
	//分页对象
	private transient PageBean pageBean;

	public PageBean getPageBean() {
		return pageBean;
	}

	public void setPageBean(PageBean pageBean) {
		this.pageBean = pageBean;
	}

	public void setUrl_type(byte url_type) {
		this.url_type = url_type;
	}

	public BaseResponse getResData() {
		if(null==resData)
		{
			resData = new BaseResponse();
		}
		return resData;
	}

	public void setResData(BaseResponse resData) {
		this.resData = resData;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public BaseBean(String req_url) {
		this.req_url = req_url;
	}

	public String getReq_url() {
		return req_url;
	}
	
	public String getReq_Dateurl() {
		if(url_type==0){
			return Config.BASE_URL+req_url;
		}else if(url_type==1){
			return req_url;
		}else if(url_type==2){
			return Config.BASE_URL+req_url;
		}else{
			return Config.BASE_URL+req_url;
		}
	}

	public boolean isAdd() {
		return isAdd;
	}

	public void setAdd(boolean isAdd) {
		this.isAdd = isAdd;
	}

	public byte getReq_type() {
		return req_type;
	}

	public void setReq_type(byte req_type) {
		this.req_type = req_type;
	}

	public int getProcessorId() {
		return processorId;
	}

	public void setProcessorId(int processorId) {
		this.processorId = processorId;
	}
	
	

	public RequestCallback getRc() {
		return rc;
	}

	public void setRc(RequestCallback rc) {
		this.rc = rc;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((req_url == null) ? 0 : req_url.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BaseBean other = (BaseBean) obj;
		if (req_url == null) {
			if (other.req_url != null)
				return false;
		} else if (!req_url.equals(other.req_url))
			return false;
		return true;
	}
}
